﻿
Public Class cTipoDocumento
    Private lDrTipoDoc As lbGlobalcom.dsGlobal.GLO_TIPODOCUMENTORow
    
    Sub New(ByVal mTipoDoc As String)
        Try
            Dim daTipoDoc As New lbGlobalcom.dsGlobalTableAdapters.GLO_TIPODOCUMENTOTableAdapter
            Dim dtTipoDoc As lbGlobalcom.dsGlobal.GLO_TIPODOCUMENTODataTable = daTipoDoc.GetDataByTipoDoc(mTipoDoc)
            If dtTipoDoc.Rows.Count > 0 Then
                lDrTipoDoc = dtTipoDoc.Rows(0)
            Else
                Throw New Exception("No existe tipo de docuemnto, verifique e intente de nuevo")
            End If
        Catch ex As Exception
            cError.SalvaError(ex, "Samuel")
            Throw ex
        End Try

    End Sub
    Public ReadOnly Property idMacro() As String
        Get
            Return cGeneral.NToCad(lDrTipoDoc("IDMACRO"))
        End Get
    End Property
    Public Property BodegaDe() As String
        Get
            Return cGeneral.NToCad(lDrTipoDoc("BODEGADE"))
        End Get
        Set(ByVal value As String)
            lDrTipoDoc.BODEGADE = value
        End Set
    End Property

    Public Property BodegaPara() As String
        Get
            Return cGeneral.NToCad(lDrTipoDoc("BODEGAPARA"))
        End Get
        Set(ByVal value As String)
            lDrTipoDoc.BODEGAPARA = value
        End Set
    End Property

    Public Property Sincroniza() As String
        Get
            Return cGeneral.NToCad(lDrTipoDoc("SINCRONIZA"))
        End Get
        Set(ByVal value As String)
            lDrTipoDoc.SINCRONIZA = value
        End Set
    End Property

    Public Property TipoDoc() As String
        Get
            Return cGeneral.NToCad(lDrTipoDoc("TIPODOC"))
        End Get
        Set(ByVal value As String)
            lDrTipoDoc.TIPODOC = value
        End Set
    End Property

    Public Property DocEs() As eTipoMovimi
        Get
            Return lDrTipoDoc("DOCES")
        End Get
        Set(ByVal value As eTipoMovimi)
            lDrTipoDoc.DOCES = value
        End Set
    End Property

    Public Property idLista() As String
        Get
            Return cGeneral.NToCad(lDrTipoDoc("IDLISTA"))
        End Get
        Set(ByVal value As String)
            lDrTipoDoc.IDLISTA = value
        End Set
    End Property

    Public Property idSede() As String
        Get
            Return cGeneral.NToCad(lDrTipoDoc("IDSEDE"))
        End Get
        Set(ByVal value As String)
            lDrTipoDoc.IDSEDE = value
        End Set
    End Property

    Public Property idCcosto() As String
        Get
            Return cGeneral.NToCad(lDrTipoDoc("IDCCOSTO"))
        End Get
        Set(ByVal value As String)
            lDrTipoDoc.IDCCOSTO = value
        End Set
    End Property

    Public Property aplicaIva() As Char
        Get
            Return cGeneral.NToCad(lDrTipoDoc("APLICAIVA"))
        End Get
        Set(ByVal value As Char)
            lDrTipoDoc.APLICAIVA = value
        End Set
    End Property

    Public Property aplicaVenta() As Char
        Get
            Return cGeneral.NToCad(lDrTipoDoc("APLICAVENTA"))
        End Get
        Set(ByVal value As Char)
            lDrTipoDoc.APLICAVENTA = value
        End Set
    End Property

    Public Property IsRecibo() As String
        Get
            Return cGeneral.NToCad(lDrTipoDoc("ISRECIBO"))
        End Get
        Set(ByVal value As String)
            lDrTipoDoc.ISRECIBO = value
        End Set
    End Property

    Public Property permiteModVal() As String
        Get
            Return cGeneral.NToCad(lDrTipoDoc("PERMITEMODVAL"))
        End Get
        Set(ByVal value As String)
            lDrTipoDoc.PERMITEMODVAL = value
        End Set
    End Property

    Public Property idConsecutivo() As String
        Get
            Return cGeneral.NToCad(lDrTipoDoc("IDCONSECUTIVO"))
        End Get
        Set(ByVal value As String)
            lDrTipoDoc.IDCONSECUTIVO = value
        End Set
    End Property


    Public Property idCaja() As String
        Get
            Return cGeneral.NToCad(lDrTipoDoc("IDCAJA"))
        End Get
        Set(ByVal value As String)
            lDrTipoDoc.IDCAJA = value
        End Set
    End Property

    Public Property existenciasNegativas() As String
        Get
            Return cGeneral.NToCad(lDrTipoDoc("EXISTENCIANEGATIVA"))
        End Get
        Set(ByVal value As String)
            lDrTipoDoc.EXISTENCIANEGATIVA = value
        End Set
    End Property



    Public Property TipoDocConvierte() As String
        Get
            Return cGeneral.NToCad(lDrTipoDoc("TIPODOCCONVIERTE"))
        End Get
        Set(ByVal value As String)
            lDrTipoDoc.TIPODOCCONVIERTE = value
        End Set
    End Property

    Public Property descripcion() As String
        Get
            Return cGeneral.NToCad(lDrTipoDoc("DESCRIPCION"))
        End Get
        Set(ByVal value As String)
            lDrTipoDoc.DESCRIPCION = value
        End Set
    End Property

    Public Property trasladoConvercion() As Char
        Get
            Return cGeneral.NToCad(lDrTipoDoc("TRASLADOCONVERSION"))
        End Get
        Set(ByVal value As Char)
            lDrTipoDoc.TRASLADOCONVERSION = value
        End Set
    End Property

    Public Property TipoDocGenera() As String
        Get
            Return cGeneral.NToCad(lDrTipoDoc("TIPODOCGENERA"))
        End Get
        Set(ByVal value As String)
            lDrTipoDoc.TIPODOCGENERA = value
        End Set
    End Property
    Protected Overrides Sub Finalize()
        lDrTipoDoc = Nothing
    End Sub

End Class

Public Enum eTipoMovimi

    Entrada = 1
    Salida = 2
    Traslado = 3
    TrasladoCodigo = 17
    Venta = 4
    Compra = 5
    Resmision = 6
    OrdenCompra = 7
    TrasladoOrdenCompra = 8
    NCVentas = 11
    NDCompras = 12
    Planes = 16
End Enum
